package com.hcb.adapter;

import java.util.ArrayList;
import java.util.Locale;

import android.app.Dialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.TextView;

import com.hcb.app911.R;
import com.hcb.dto.ContactsDTO;

public class AdapterListPhoneNumber extends ArrayAdapter<Object> {
	Context mContext;
	private ArrayList<Object> arrObject;
	Dialog dialog;
	Button btnyes, btnno;

	public AdapterListPhoneNumber(Context context, int resource,
			ArrayList<Object> arr) {
		super(context, resource, arr);
		mContext = context;
		arrObject = arr;
	}

	class viewHolder {
		TextView txtContacname;
		TextView txtContacnumber;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return arrObject.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return arrObject.get(position);
	}

	@Override
	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(final int position, View convertView, ViewGroup parent) {
		LayoutInflater inflater = (LayoutInflater) mContext
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

		View rowView;
		rowView = inflater.inflate(R.layout.adapter_list_phone_number, parent,
				false);

		viewHolder holder = new viewHolder();

		// holder.icon = (ImageView) rowView.findViewById(R.id.icon);
		holder.txtContacname = (TextView) rowView
				.findViewById(R.id.txtContacname);
		holder.txtContacnumber = (TextView) rowView
				.findViewById(R.id.txtContacnumber);

		ContactsDTO dto = (ContactsDTO) arrObject.get(position);
		// holder.icon.setImageResource(dto.getImg());
		holder.txtContacname.setText(dto.getName());
		holder.txtContacnumber.setText(dto.getNumber());

		return rowView;
	}

	

}
